(function ($) {
  "use strict";
  /*
  * author GL
  * */
  $.pushHistory = function (str) {
    var state = {  
      title: $("title").text(),  
      url: str || "#"
    };
    window.history.pushState(state, state.title, state.url);
  }
  $.popstate = function (fn) {
    // $.pushHistory();
    var bool = false;
    setTimeout(function () {
      bool = true;
    }, 300);
    window.addEventListener("popstate", function (e) {
      if (bool) {
        fn();
      }
    }, false);
  };
})($);